//思考题：1.编写一个函数，将数组中的数据首尾互换  2. 用递归的方法实现该题
#include<stdio.h>
void exchange(int a[],int n,int m)
{
	static int i = 0;
	int t = 0;
	t = a[n-1];
	a[n-1] = a[i];
	a[i] = t;
	i++;
	if(n-1 > m)
		exchange(a,n-1,m);
}
void print(int a[],int n)
{
	for(int i = 0; i < n; i++)
	{
		printf("%4d",a[i]);
	}
	printf("\n");
}
int main()
{
	int a[] = {12,58,69,45,36,15,26,75,84,35};
	int n = sizeof a / sizeof a[0];
	int m = n / 2;
	print(a,n);
	exchange(a,n,m);
	print(a,n);
	return 0;
}
